package net.bwie.realtime.jtp.jtprealtimepub.controller;


import com.alibaba.fastjson.JSON;
import net.bwie.realtime.jtp.jtprealtimepub.bean.TraffiChannelUvBean;
import net.bwie.realtime.jtp.jtprealtimepub.service.TrafficChannelStartServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/jtp/traffic")
public class TrafficController {
    @Autowired
    TrafficChannelStartServiceImpl  trafficChannelStartService;

    final String date_value_default="2025-05-18";
    @RequestMapping("/channel/uv")
    public String getUvCount(@RequestParam(value = "date",defaultValue = date_value_default) String date)
    {


        List<TraffiChannelUvBean> uvCount = trafficChannelStartService.getUvCount(date);
        if (null==uvCount||uvCount.isEmpty()){
            return "[]";
        }
        return JSON.toJSONString(uvCount);
    }


}
